package com.pos.clothes;

import com.pos.clothes.interceptor.NormsHandle;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@SpringBootApplication

public class ClothesApplication implements WebMvcConfigurer {

    public static void main(String[] args) {
        SpringApplication.run(ClothesApplication.class, args);
    }

//   拦截器配置
    @Override
    public void addInterceptors(InterceptorRegistry registry){
        InterceptorRegistration ir = registry.addInterceptor(new NormsHandle());
//        指定拦截器匹配模式，限制拦截器请求
        ir.addPathPatterns("/Norms/serchNorms");
    }
}
